{template 'header.html'}
{template 'system/cslide.html'}
<!-- 面包屑导航开始 -->
{template 'position.html'}
<!-- 面包屑导航结束 -->


<link href="{$skin_path}/css/comment.css" rel="stylesheet">


<!-- 页面标题开始 -->
<div class="title">
<h3><a>{lang(commentlist)}<small>List</small></a></h3>
<p></p>
<span>——</span>
</div>

<hr class="featurette-divider">


<div class="container">

<div class="blank30"></div>

<style type="text/css">
/****************评论*/
#comment {
  margin-top:20px;
  font-size:12px;
}

#comment input {font-size:12px;}

.comm input {/*border:none; background:#F6F6F6;*/}
.comm input:hover {
-moz-box-shadow:0px 0px 10px #A5C7FE;
-webkit-box-shadow:0px 0px 10px #A5C7FE;
box-shadow:0px 0px 10px #A5C7FE;}

.comment_list {padding:10px 0px;border-top:1px solid #ccc;}
.comm_head {float:left; width:90px; height:90px; background: url({$skin_path}/images/comm/comm_m.png) left top no-repeat;background-size:70% 70%;}

#comm_content {width:15px; height:15px; position: relative; top:10px; left:-28px; background: url(../images/comm/comm_content.gif) left top no-repeat;}
.comm_content {float:left; width:240px; padding:0px 10px 0px 20px; background:#F5F5F5; border:1px solid #ccc;border-radius: 3px 3px 3px 3px; overflow:hidden;}

.comm_content p span {color:#999; font-size:12px; padding-left:15px;}
.comm_content p strong {color:#666;}


.commentnumber {padding:0px 5px;color:#CC0000;}
.comment_info {height:30px; line-height:30px; padding-left:30px;background:url({$skin_path}/images/comm/comment.gif) left center no-repeat;}

.comment_list dt strong {color: #70AADA;}
.comment_list dd.admin_reply  {margin:10px; padding:10px;border:1px dotted #ccc; background:#FFFFEE;}
.comm_name,.comm_code {float:left; height:32px; line-height:32px; padding:0px 10px; border:1px solid #ccc; color:#666; border-radius: 3px 0px 0px 3px;}
.comm_name:hover,.comm_code:hover { background-color:#FFC;}	
.comm_name {width:206px;border-radius: 3px 3px 3px 3px;}

#mobilenum { float:left; width:150px; height:32px; line-height:32px; padding:0px 10px; }
#btm_sendMobileCode {float:left; height:32px; line-height:32px; margin-right:10px; padding:0px 15px; border:1px solid #ccc; border-radius: 5px 5px 5px 5px; font-size:12px; color:#555; background:#eee;}

#textarea { width:100%; min-height:88px; padding:10px; /* border:none; padding:10px; background:#F6F6F6;*/}
#textarea:hover {background-color:#FFC;
-moz-box-shadow:0px 0px 10px #A5C7FE;
-webkit-box-shadow:0px 0px 10px #A5C7FE;
box-shadow:0px 0px 10px #A5C7FE;}

input.btn {background:#2065C4;color:white;}
.comm {padding:10px;}
#comment_list li{ padding:10px; border:1px solid #dedede; height:auto; background:#fff; margin:8px;border-radius: 5px;}
#comment_list li .h,#comment_list li .f{  height:35px; line-height:35px; clear:both; width:100%;}
#comment_list li .h .name{float:left;}
#comment_list li .h .date{float:right;}
#comment_list li .p{padding:10px 0px; width:100%; line-height:2em; border:1px dashed #dedede; border-left:none; border-right:none;}
#comment_list li .f span{ float:right; margin-left:10px;}
#pageNav a{color:#2B4A78;text-decoration:none;}a:hover{color:#2B4A78;text-decoration:underline;}
#pageNav a:focus,input:focus{outline-style:none;outline-width:medium;}
.pageNum{border:1px solid #999;padding:2px 8px;display:inline-block;}
.cPageNum{font-weight:bold;padding:2px 5px;}
#pageNav{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none; padding:10px;}
#pageNav a:hover{text-decoration:none;background:#fff4d8;}
.zan_btn{ cursor:pointer}
.reply_btn{cursor:pointer}
.re_btn{ padding:4px;}
.bor{ margin:4px auto; padding:6px; background:#eee; border:#ccc 1px solid;border-radius: 5px;}
.bor .p{background:#eee;}

.blk{width:300px;position:relative;}
.blk .head, .blk .head-right, .blk .foot, .blk .foot-right{overflow:hidden;}
.blk .head{padding-left:4px;}
.blk .head-right{background-position:right top;}
.blk .foot{padding-left:4px;background-position:left bottom;_height:3px;}
.blk .foot-right{background-position:right bottom;}
.blk .main{border:2px solid #85B6E2;position:relative;background:#fff; width:auto !important;}
.blk .main h2{font:bold 16px;padding:10px 20px 2px;color:#85B6E2;}
.blk .main ul{padding:20px;zoom:1;overflow:hidden;font-size:12px;}
.blk .main ul li{float:left;width:100px;text-align:center;line-height:30px;margin-bottom:10px;}
.blk .main ul li a{color:#333;display:block;}
.blk .main ul li a:hover{background:#85B6E2;color:#fff;font-weight:bold;font-size:14px;}
.reply-info{ padding:10px; margin:0px auto;}
.reply-textarea {width:280px; width:140px; -moz-box-shadow: 3px 3px 4px #DFDFDF;-webkit-box-shadow: 3px 3px 4px #DFDFDF;box-shadow: 3px 3px 4px #DFDFDF; }

</style>
 
{if config::get('reply_comment')=='1'}
<!-- 评论框开始 -->
 
<script src="{$base_url}/js/layer/layer.js"></script>
<script type="text/javascript" src="{$base_url}/js/pagenav1.1.cn.js"></script>
<script type="text/javascript">

function getcommentdata(p){
	$.ajax({
	   type: "get",
	   url: "<?php echo url('comment/ajax/aid/'.$aid); ?>",
	   dataType: 'json',
	   data: "p="+p,
	   success: function(msg){
		 //console.log(msg);
		 $('#comment_list').empty();
		 for(row in msg){
			//console.log(msg[row]); 
			$('#comment_list').append("<li><div class='h'><span class='name'>"+msg[row].username+"</span><span class='date'>"+msg[row].adddate+"</span></div><div class='p'>"+msg[row].content+"</div><div class='f'><span class='zan_btn' data-aid='<?php echo $aid; ?>' data-cid='"+msg[row].id+"'>{lang(praise)}[<i id='zan_"+msg[row].id+"'>"+msg[row].zannum+"</i>]</span><span class='reply_btn' id='reply_btn_"+msg[row].id+"' data-raid='<?php echo $aid; ?>' data-rcid='"+msg[row].id+"'>{lang(reply)}</span></div><div class='clear'></div></li>");
			//<div style='display:none;' id='rcid_"+msg[row].id+"'><textarea id='trid_"+msg[row].id+"' name='content' rows='6' cols='50'></textarea><br /><input name='submit' value='发表回复' type='button' data-baid='<?php echo $archive['aid']; ?>' data-brid='"+msg[row].id+"' class='re_btn' /></div>
		 }
		 $('.zan_btn').click(function(e) {
			var id = $(this).data('cid');
			var aid = $(this).data('aid');
			$.get("{url('comment/zan')}",{"id":id,"aid":aid},function(data){
				if(data != "unsign"){
					alert('{lang(point-like)}{lang(success)}');
					$('#zan_'+id).html(data);	
				}else{
					alert('{lang(not_logged)}');	
				}
			});
			//console.log(aid);
		});
		
		$('.reply_btn').click(function(){
			var rcid = $(this).data('rcid');
			var raid = $(this).data('raid');
			
			layer.open({
				type: 1,
				skin: 'layui-layer-rim', //加上边框
				 title: '{lang(submit_on)}{lang(reply)}',
				area: ['300px', '300px'], //宽高
				content: "<div class='reply-info'><form id='frmreply' action='<?php echo url('comment/reply');?>' method='post' name='frmreply'><textarea name='content' class='reply-textarea' style='width:256px;height:120px; padding:10px; '></textarea><input name='aid' value='"+raid+"' type='hidden' /><input name='rid' value='"+rcid+"' type='hidden' /><div class='blank10'></div><button class='btn btn-primary'  type='submit' name='submit' value='{lang('submit_on')}'>{lang('submit_on')} <span class='badge'>Guestbook</span></button></div>"
			});
			
		});
		$('.re_btn').click(function(e) {
            var brid = $(this).data('brid');
			var baid = $(this).data('baid');
			var content = $('#trid_'+brid).val();
			if(content == ''){
				alert('{lang(please_fill_in_the_content)}');
				$('#trid_'+brid).focus();
				return;	
			}else{
				$.post("{url('comment/reply')}",{"rid":brid,"aid":baid,"content":content},function(data){
					if(data != "unsign"){
						alert('{lang(reply)}{lang(success)}');
						//$('#zan_'+id).html(data);	
						getcommentdata(1);
					}else{
						alert('{lang(not_logged)}');	
					}
				});
			}
        });
	   }
	});
}

//$(function(){ //for jquery
$(function(){
	//getcommentdata(1);
	//optional set
	pageNav.pre="{lang(uppage)}";
	pageNav.next="{lang(downpage)}";
	

	 //  p,当前页码,pn,总页面
	pageNav.fn = function(p,pn){
		//document.getElementById("test").innerHTML ="当前页:"+p+"  ,  总页: "+pn;
		//$("#test").text("Page:"+p+" of "+pn + " pages."); // jquery调用方式
		getcommentdata(p);
	};
	
	//重写分页状态,跳到第三页,总页33页
	pageNav.go(1,{$pages});
	
	

});

  </script>
<script src="{$base_url}/js/mobilechk.js"></script>

<div class="blank30"></div>


<!-- 页面标题开始 -->
<div class="title">
	<div class="container">
	<h3>{lang(comment)}</h3>
	<p>Comment</p>
	</div>
</div>
<!-- 页面标题结束 -->



<div class="container">
<?php
if(front::$user['userid']){
?>

<div class="comm">
<form action="<?php echo url('comment/add'); ?>" method="POST" name="comment_form" id="comment">
<div class="blank10"></div>
<input type="hidden" name="aid" value="{$aid}"/>
<input type="hidden" name="username" class="comm_name" value="<?php echo front::$user['userid'];?>" />
<input type="hidden" name="username" class="comm_name" value="<?php echo front::$user['username'];?>" />
<div class="blank10"></div>
{if config::get('mobilechk_enable') && config::get('mobilechk_comment')}
<script src="{$base_url}/js/mobilechk.js"></script>
{lang(tel)} Tel
<div class="blank10"></div>
<input type="text" class="comm_name" name="telphone" id="telphone" />
<div class="blank10"></div>
{lang(phone_verification_code)}
<div class="blank10"></div>
<input id="btm_sendMobileCode" onclick="sendMobileCode('{url('tool/smscode')}',$('#telphone'));" type="button" value="{lang(send_cell_phone_verification_code)}" />
<input type='text' id="mobilenum"  tabindex="4" placeholder="	{lang(please_enter_the_phone_verification_code)}	"  name="mobilenum" />
<div class="blank10"></div>
{/if}

<div class="blank10"></div>
{lang(comment)} Comment
<div class="blank10"></div>
<textarea name="content" id="textarea"  ></textarea>



<div class="blank30"></div>

<button class="btn btn-primary"  type="submit" name="submit" value="{lang('submit_on')}">{lang('submit_on')} <span class="badge">Guestbook</span></button>
<div class="blank30"></div>

<div class="comment_info">
<span class="commentnumber">{lang('have')}({comment::countcomment($aid)}){lang(bitofcommenters)}{lang('clicktoview')}</span>
</div>
</form>
<div class="blank60"></div>
</div>
</div>
<?php
}else{
?>
<div class="blank60"></div>
<input type="button" value=" {lang(please)}{lang(login)} " onclick="window.open('{url('user/login')}')" class="btn" />
<?php
}
?>


<div class="blank30"></div>
{if config::get('comment_list')=='1'} 
<!-- 页面标题开始 -->


<!-- 页面标题开始 -->
<div class="title">
	<div class="container">
	<h3>{lang('commentlist')}</h3>
	<p>Comment List</p>
	</div>
</div>
<!-- 页面标题结束 -->


<div class="clear blank30"></div>
<div class="container">
<!-- 评论列表开始 -->
<div id="comment_list"></div>
<div id="pageNav"></div>
<!-- 评论列表结束 -->
<div class="clear blank30"></div>
</div>
{else}
<!-- 页面标题开始 -->
<div class="title">
	<div class="container">
<h3>{lang(commentlist)}{lang(close)}</h3>
<p>Comment List</p>
	</div>
</div>
<!-- 页面标题结束 -->

{/if}
<div class="clear blank30"></div>

{else}



<!-- 评论框开始 -->



<!-- 页面标题开始 -->
<div class="title">
	<div class="container">
	<h3>{lang(comment)}</h3>
	<p>Comment</p>
	</div>
</div>

<!-- 页面标题结束 -->

<div class="container">

<div class="blank30"></div>

<form action="<?php echo url('comment/add'); ?>" method="POST" name="comment_form" id="comment">
<div class="comm">


<div class="blank10"></div>
		<input type="hidden" name="aid" value="{$aid}"/>

		<div class="form-group">
<label for="{lang(ordertel)}">{lang('username')}</label>
<input type="text" class="form-control comm_name" name="username" value="<?php echo get('username');?>" placeholder="" />
</div>


		{if config::get('mobilechk_enable') && config::get('mobilechk_comment')}
		<script src="{$base_url}/js/mobilechk.js"></script>
		{lang(tel)} Tel
		<div class="blank10"></div>
		<input type="text" class="comm_name" name="telphone" id="telphone" />
		<div class="blank10"></div>
		{lang(phone_verification_code)}
		<div class="blank10"></div>
		<input id="btm_sendMobileCode" onclick="sendMobileCode('{url('tool/smscode')}',$('#telphone'));" type="button" value="{lang(send_cell_phone_verification_code)}" />
		<input type='text' id="mobilenum"  tabindex="4" placeholder="	{lang(please_enter_the_phone_verification_code)}	"  name="mobilenum" />
		<div class="blank10"></div>
		{/if}

<div class="form-group">
<label for="{lang(ordertel)}">{lang(comment)}</label>
<textarea name="content" id="textarea" class="form-control" rows="3" ></textarea>
</div>


{if config::get('verifycode')=='1'}
		<div class="balnk10"></div>
		{lang('verifycode')}
		<div class="blank20"></div>
		<input type='text' id="verify"  tabindex="3"  name="verify" />{verify()}
		<div class="balnk10"></div>
		{/if}

		{if config::get('verifycode')=='2'}
		<div class="blank20"></div>
		<div id="verifycode_embed"></div>
		<script src="http://api.geetest.com/get.php"></script>
		<script>
		var loadGeetest = function(config) {
			window.gt_captcha_obj = new window.Geetest({
				gt : config.gt,
				challenge : config.challenge,
				product : 'float',
				offline : !config.success
			});
			gt_captcha_obj.appendTo("#verifycode_embed");
		};

		$.ajax({
			url : '{url('tool/geetest',0)}',
			type : "get",
			dataType : 'JSON',
			success : function(result) {
				//console.log(result);
				loadGeetest(result)
			}
		});
		</script>
		{/if}

		<div class="blank30"></div>
		<input name="submit" class="btn" value=" {lang('submit_on')} " type="submit" />
		<div class="blank30"></div>

		<div class="comment_info">
		{if $topid==0}{else}<a rel="nofollow" href="<?php echo url('comment/list/aid/'.$archive['aid']); ?>">{/if}{lang('have')}<span class="commentnumber">({comment::countcomment($archive['aid'])})</span>{lang(bitofcommenters)}&nbsp;&nbsp;<strong>{lang('clicktoview')}</strong></a>
		</div>

	</div><!-- /comm -->
	</form>

<!-- 评论框结束 -->
<div class="clear blank30"></div>

<?php 
if(config::get('comment_user')){ 
?>

<!-- 评论列表开始 -->
{comment_js($aid)}
<!-- 评论列表结束 -->

<?php
}else{
?>

<?php
if(front::$user['userid']){
?>


<!-- 评论列表开始 -->
{comment_js($aid)}
<!-- 评论列表结束 -->

<?php
}else{
?>
<div class="container">
<input type="button" value=" {lang(please)}{lang(login)} " onclick="window.open('{url('user/login')}')" class="btn" />
</div>
<?php
}
?>

<?php  } ?>

{/if}





</div><!-- /container -->


<div class="blank60"></div>
<div class="blank60"></div>


<!-- 页底推荐图文产品开始 -->
{tag_内容页底图文产品三条}



{template 'footer.html'}